home *** CD-ROM | disk | FTP | other *** search
/ Gold Medal Software 1 / Gold Medal Software Volume 1 (Gold Medal) (1994).iso / prog / tpwprog5.arj / MULTI.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1992-07-02  |  1.2 KB  |  57 lines

  1. { multi.pas -- Multiple application instances }
  2.  
  3. program Multi;
  4.  
  5. uses WinTypes, WinProcs, WObjects;
  6.  
  7. type
  8.  
  9.   MultiApplication = object(TApplication)
  10.     FirstInstance: Boolean;
  11.     constructor Init(AName: PChar);
  12.     procedure InitMainWindow; virtual;
  13.     procedure InitApplication; virtual;
  14.   end;
  15.  
  16. {- Initialize firstInstance data field }
  17. constructor MultiApplication.Init(AName: PChar);
  18. begin
  19.   FirstInstance := false;
  20.   TApplication.Init(AName)
  21. end;
  22.  
  23. {- Called to initialize first instance only }
  24. procedure MultiApplication.InitApplication;
  25. begin
  26.   FirstInstance := true
  27. end;
  28.  
  29. {- Initialize the application's window }
  30. procedure MultiApplication.InitMainWindow;
  31. var
  32.   P: PChar;
  33. begin
  34.   if FirstInstance then
  35.     P := 'First Instance'
  36.   else
  37.     P := 'Another Instance';
  38.   MainWindow:= New(PWindow, Init(nil, P))
  39. end;
  40.  
  41. var
  42.  
  43.   MultiApp: MultiApplication;
  44.  
  45. begin
  46.   MultiApp.Init('Multi');
  47.   MultiApp.Run;
  48.   MultiApp.Done
  49. end.
  50.  
  51.  
  52. { --------------------------------------------------------------
  53.   Copyright (c) 1991 by Tom Swan. All rights reserved.
  54.   Revision 1.00    Date: 1/24/1991
  55.   ------------------------------------------------------------- }
  56.  
  57.